package cn.flying.cloud.flow.core.enums;

import cn.flying.cloud.base.common.enums.BaseEnumInfo;

/**
 * 任务审批状态
 *
 * @author: admin
 * @date: 2024年10月22日 15:59
 * @version: 1.0
 */
public enum TaskStateEnum implements BaseEnumInfo {

    A("A", "通过"),
    R("R", "拒绝"),
    D("D", "驳回"),
    F("F", "失败"),
//    W("W", "委托"),
    ;

    private final String code;
    private final String text;

    TaskStateEnum(String code, String text) {
        this.code = code;
        this.text = text;
    }

    /**
     * 获取枚举码值
     *
     * @return
     */
    @Override
    public String getCode() {
        return code;
    }

    /**
     * 获取枚举描述
     *
     * @return
     */
    @Override
    public String getDesc() {
        return text;
    }

    public static String val(String code) {
        TaskStateEnum[] values = TaskStateEnum.values();
        for (TaskStateEnum value : values) {
            if (value.getCode().equals(code)) {
                return value.getDesc();
            }
        }
        return "";
    }
}
